home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
la50.arc
/
LA50.ASM
next >
Wrap
Assembly Source File
|
1985-05-25
|
10KB
|
295 lines
page 62, 132
title LA50 -- LA50 Personal Printer Setup, Version 1.0
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++;
; ;
; Program: LA50 ;
; ;
; Purpose: To provide an "easy-to-use", menu driven, setup program for ;
; the DEC LA50 Personal Printer. Program allows user to set ;
; the horizontal pitch, vertical pitch and print density. If ;
; you set the vertical pitch, the page length is automatically ;
; set to the apprpriate number of line for an 11 inch page. ;
; ;
; To create LA50.EXE issue the following commands in MS-Dos. ;
; ;
; MASM LA50; ;
; LINK LA50; ;
; ;
; The file LA50.EXE should contain 2234 bytes. ;
; ;
; Copyright: (C) Copyright 1985 by Robert E. Davis, all rights reserved. ;
; ;
; Members of the VAX Forum on CompuServe Incorporated's ;
; Consumer Information Service are granted a limited license ;
; to use and distribute this software, provided it contains ;
; this message, any enhancements or bug fixes made to the ;
; software are reported to: ;
; ;
; Robert E. Davis ;
; %CompuServe Incorporated ;
; P.O. Box 20212 ;
; Columbus, OH 43220 ;
; ;
; and no compensation is received for the distribution of the ;
; software in either source or executable form. ;
; ;
; ;
; Version 1.0 Robert E. Davis May 24, 1985 ;
; ;
;----------------------------------------------------------------------------;
;+
; Macro Definitions
;-
$Read_KBD_And_Echo macro
mov AH, 1
int 21H
endm
$Display_Char macro Character
mov DL, Character
mov AH, 2
int 21H
endm
$Print_Char macro Character
mov DL, Character
mov AH, 5
int 21H
endm
$Read_KBD macro
mov AH, 8
int 21H
endm
$Display macro String
mov DX, offset String
mov AH, 9
int 21H
endm
$Exit macro Code
mov AL, Code
mov AH, 4CH
int 21H
endm
;+
; Stack Segment Definition
;-
stack segment byte stack
db 64 dup (?)
stack ends
;+
; Data Segment Definition
;-
data segment
Resp_Main dw Horz_Pitch, Vert_Pitch, Print_Dens, Exit
Horz_Pitch_Tab db '568024'
Vert_Pitch_Tab db '456123'
Page_Len_Tab db '022033044066088132'
Print_Dens_Tab db '12'
Clear_Screen db 27, '[2J', 27, '[H$'
Clear_Menu db 27, '[6;1H', 27, '[0J$'
Program_Banner db 27, '[2;1H'
db 27, '#3 LA50 Personal Printer Setup, V 1.0'
db 13, 10
db 27, '#4 LA50 Personal Printer Setup, V 1.0'
db 13, 10, 27, '[24;11H'
db '(C) Copyright 1985 by Robert E. Davis, '
db 'all rights reserved.$'
Enter_Choice db 'Enter choice? $'
Menu1 db 27, '[06;31H', 'Main Menu'
db 27, '[08;31H', '1 Horizontal Pitch'
db 27, '[09;31H', '2 Vertical Pitch'
db 27, '[10;31H', '3 Print Density'
db 27, '[11;31H', '4 Exit'
db 27, '[13;31H$'
Horz_Menu db 27, '[06;27H', 'Horizontal Pitch Menu'
db 27, '[08;27H', '1 5 characters per inch'
db 27, '[09;27H', '2 6 characters per inch'
db 27, '[10;27H', '3 8 characters per inch'
db 27, '[11;27H', '4 10 characters per inch'
db 27, '[12;27H', '5 12 characters per inch'
db 27, '[13;27H', '6 16 characters per inch'
db 27, '[15;27H$'
Vert_Menu db 27, '[06;30H', 'Vertical Pitch Menu'
db 27, '[08;30H', '1 2 lines per inch'
db 27, '[09;30H', '2 3 lines per inch'
db 27, '[10;30H', '3 4 lines per inch'
db 27, '[11;30H', '4 6 lines per inch'
db 27, '[12;30H', '5 8 lines per inch'
db 27, '[13;30H', '6 12 lines per inch'
db 27, '[15;30H$'
Dens_Menu db 27, '[06;30H', 'Print Density Menu'
db 27, '[08;30H', '1 Draft density'
db 27, '[09;30H', '2 Enhanced density'
db 27, '[11;30H$'
Error_A db 27, '[20;20H', '? LA50 - Invalid choice <$'
Error_B db 27, '[20;46H', '> entered.'
db 27, '[22;29H', 'Enter <CR> to continue$'
Bytes_Per_Word db 2
Char db (?)
Len_Char db 3 dup (?)
data ends
code segment
assume CS:code, DS:data, ES:data, SS:stack
org 100h
Start proc far ;+
mov AX, data ; Set up data segment
mov DS, AX ; ........
$Display Clear_Screen ; Announce program
$Display Program_Banner ; ........
jmp Display_Main ; Proceed to main menu
;
Error_Main: call Error ; Display error msg
;
Main: $Display Clear_Menu ; Clear old menu
Display_Main: $Display Menu1 ; Prompt for function
$Display Enter_Choice ; to be performed &
$Read_KBD_and_Echo ; accept response
xor AH, AH ; Determine if the
mov Char, AL ; response was valid
cmp AL, '1' ; If not, process the
jl Error_Main ; error
cmp AL, '4' ; ........
jg Error_Main ; ........
sub AL, '1' ; If so, convert to an
mul Bytes_Per_Word ; offset into table
mov BX, AX ; of routines
call word ptr Resp_Main[BX] ;
jmp Main ; Return to main menu
;
Start endp ;-
Horz_Pitch proc ;+
jmp HP_Menu ; Proceed to menu
;
Error_Horz: call Error ; Display message if
; invalid choice
HP_Menu: $Display Clear_Menu ; Clear old menu
$Display Horz_Menu ; Display horizontal
$Display Enter_Choice ; pitch menu
$Read_KBD_and_Echo ; Read user's choice
xor AH, AH ; Check validity of
mov Char, AL ; response
cmp AL, '1' ; If not valid,
jl Error_Horz ; process error
cmp AL, '6' ; ........
jg Error_Horz ; ........
sub AL, '1' ; If valid, make into
mov BX, AX ; table offset
mov AL, Horz_Pitch_Tab[BX] ; Get pitch character
mov Char, AL ; and save it
$Print_Char 1Bh ; Send escape sequence
$Print_Char 5Bh ; for horizontal
$Print_Char Char ; pitch change
$Print_Char 77h ; ........
ret ; Return to caller
Horz_Pitch endp ;-
Vert_Pitch proc ;+
jmp VP_Menu ; Proceed to menu
;
Error_Vert: call Error ; Display message if
; invalid choice
VP_Menu: $Display Clear_Menu ; Clear old menu
$Display Vert_Menu ; Display vertical
$Display Enter_Choice ; pitch menu
$Read_KBD_and_Echo ; Read user's choice
xor AH, AH ; Check validity of
mov Char, AL ; response
cmp AL, '1' ; If not valid,
jl Error_Vert ; process error
cmp AL, '6' ; ........
jg Error_Vert ; ........
sub AL, '1' ; If valid, make into
mov BX, AX ; table offset
mov AL, Vert_Pitch_Tab[BX] ; Get pitch character
mov Char, AL ; and save it
mov AX, 3 ; Get page length
mul BX ; character
push AX ; ........
$Print_Char 1Bh ; Send escape sequence
$Print_Char 5Bh ; for vertical
$Print_Char Char ; pitch change
$Print_Char 7Ah ; ........
$Print_Char 1Bh ; and for page
$Print_Char 5Bh ; length
pop BX ;
$Print_Char Page_Len_Tab[BX] ; ........
$Print_Char Page_Len_Tab[BX+1] ; ........
$Print_Char Page_Len_Tab[BX+2] ; ........
Next_Char: $Print_Char 74h ; ........
ret ; Return to caller
Vert_Pitch endp ;-
Print_Dens proc ;+
jmp PD_Menu ; Proceed to menu
;
Error_Dens: call Error ; Display message if
; invalid choice
PD_Menu: $Display Clear_Menu ; Clear old menu
$Display Dens_Menu ; Display print
$Display Enter_Choice ; density menu
$Read_KBD_and_Echo ; Read user's choice
xor AH, AH ; Check validity of
mov Char, AL ; response
cmp AL, '1' ; If not valid,
jl Error_Dens ; process error
cmp AL, '2' ; ........
jg Error_Dens ; ........
sub AL, '1' ; If valid, make into
mov BX, AX ; table offset
mov AL, Print_Dens_Tab[BX] ; Get density char
mov Char, AL ; and save it
$Print_Char 1Bh ; Send escape sequence
$Print_Char 5Bh ; for print density
$Print_Char Char ; change
$Print_Char 22h ; ........
$Print_Char 7Ah ; ........
ret ; Return to caller
Print_Dens endp ;-
Exit proc ;+
$display Clear_Screen ; Clear the screen
$Exit 0 ; Exit program
Exit endp ;-
Error proc ;+
$Display Error_A ; Display invalid
cmp Char, 20h ; choice message
jl Err_B_Display ; ........
cmp Char, 7Eh ; ........
jg Err_B_Display ; ........
Err_B_Display: $Display_Char Char ; ........
$Display Error_B ; ........
Cont_on_CR: $Display_Char 7 ; Ring bell on error
$Read_KBD ; Require <CR> to
cmp AL, 13 ; to continue
jne Cont_on_CR ; ........
ret ; Return to caller
Error endp ;-
code ends
end Start